﻿<UserControl x:Class="Microsoft.Research.ScientificWorkflow.UIDesigner.ActivityHeader"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="Auto"  Width="Auto" VerticalAlignment="Top" VerticalContentAlignment="Top"
             xmlns:ImgConverter="clr-namespace:Microsoft.Research.ScientificWorkflow.UIDesigner">
    <UserControl.Resources>
        <ImgConverter:UpdateVisibilityConverter x:Key="UpdateVisibilityConverter"/>
        <ImgConverter:ExecutionStatusImageConverter x:Key="ExecutionStatusImageConverter"/>
        <Storyboard x:Key="progressAnimation" RepeatBehavior="Forever">
            <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                <SplineColorKeyFrame KeyTime="00:00:00" Value="#66FFFFFF"/>
                <SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="#FFFFFFFF"/>
                <SplineColorKeyFrame KeyTime="00:00:00.6000000" Value="#66FFFFFF"/>
            </ColorAnimationUsingKeyFrames>
            <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle1" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                <SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="#66FFFFFF"/>
                <SplineColorKeyFrame KeyTime="00:00:00.6000000" Value="#FFFFFFFF"/>
                <SplineColorKeyFrame KeyTime="00:00:00.9000000" Value="#66FFFFFF"/>
            </ColorAnimationUsingKeyFrames>
            <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle2" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                <SplineColorKeyFrame KeyTime="00:00:00.6000000" Value="#66FFFFFF"/>
                <SplineColorKeyFrame KeyTime="00:00:00.9000000" Value="#FFFFFFFF"/>
                <SplineColorKeyFrame KeyTime="00:00:01.2000000" Value="#66FFFFFF"/>
            </ColorAnimationUsingKeyFrames>
        </Storyboard>
        <Style x:Key="plusButtonWF" BasedOn="{x:Null}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Rectangle Fill="#FFFFFFFF" Stroke="#FF94B3C4" RadiusX="3" RadiusY="3" x:Name="rectangle"/>
                            <Rectangle Fill="#FF3B6A7A" Stroke="{x:Null}" Margin="5.996,2.998,6.004,3.002"/>
                            <Rectangle Fill="#FF3B6A7A" Stroke="{x:Null}" Margin="5.996,2.998,6.004,3.002" RenderTransformOrigin="0.5,0.5">
                                <Rectangle.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="90"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Rectangle.RenderTransform>
                            </Rectangle>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True"/>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Fill" TargetName="rectangle" Value="#FFCDEAF1"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True"/>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="MinusButtonWF" BasedOn="{x:Null}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Rectangle Fill="#FFFFFFFF" Stroke="#FF94B3C4" RadiusX="3" RadiusY="3" x:Name="rectangle"/>
                            <Rectangle Fill="#FF3B6A7A" Stroke="{x:Null}" Margin="5.996,2.998,6.004,3.002" RenderTransformOrigin="0.5,0.5">
                                <Rectangle.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="90"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Rectangle.RenderTransform>
                            </Rectangle>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True"/>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Fill" TargetName="rectangle" Value="#FFCDEAF1"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True"/>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="subsectionCloseButton" BasedOn="{x:Null}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Ellipse Fill="#00FFFFFF" Stroke="{x:Null}" x:Name="ellipse"/>
                            <Path Fill="#FF5E8693" Stretch="Fill" Stroke="{x:Null}" Margin="4.474,5.297,4.612,6.725" Data="M514.15779,259.009 L519.51824,263.07786 525.07244,259.009 523.78067,257.65276 519.60972,259.8383 515.19117,257.45892 z" RenderTransformOrigin="0.5,0.5">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="-1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="0"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True"/>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Fill" TargetName="ellipse" Value="#FFD6D6D6"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True"/>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="SubsectionExpandButton" BasedOn="{x:Null}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Ellipse Fill="#00FFFFFF" Stroke="{x:Null}" x:Name="ellipse" Width="17" Height="17"/>
                            <Path Fill="#FF5E8693" Stretch="Fill" Stroke="{x:Null}" Margin="4.474,6.297,4.612,5.725" RenderTransformOrigin="0.5,0.5" Data="M514.15779,259.009 L519.51824,263.07786 525.07244,259.009 523.78067,257.65276 519.60972,259.8383 515.19117,257.45892 z">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="0"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True"/>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Fill" TargetName="ellipse" Value="#FFAECCD6"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True"/>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ButtonStyleOptions" BasedOn="{x:Null}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Border CornerRadius="3,3,3,3" BorderBrush="#7FFFFFFF" BorderThickness="1,1,1,1" x:Name="border">
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FFCCF4FF" Offset="0"/>
                                        <GradientStop Color="#FF96CBDE" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                            <Path Fill="#FF000000" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Center" Width="3.992" RenderTransformOrigin="0.500000073680912,0.250905141174393" Data="M1.6202802,0 L5.1354571,5.5040046 5.1610003,5.5040003 5.1482273,5.5239998 5.1610003,5.5439998 5.1354571,5.543995 1.6202803,11.048 0,10.513274 2.2801195,5.5240008 1.6462806E-07,0.53472566 1.6202802,0 z" VerticalAlignment="Stretch" Opacity="0.8" Margin="0,6.824,0,0.225">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="-1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="0"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True">
                                <Setter Property="Background" TargetName="border">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFCAE6F4" Offset="0"/>
                                            <GradientStop Color="#FF3AAFE8" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" TargetName="border">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFFFBA40" Offset="0"/>
                                            <GradientStop Color="#FFFFDFA5" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Background" TargetName="border">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFFFDFA5" Offset="0"/>
                                            <GradientStop Color="#FFFFB83B" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <UserControl.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <BeginStoryboard Storyboard="{StaticResource progressAnimation}"/>
        </EventTrigger>
    </UserControl.Triggers>
    <Border BorderBrush="#FFB5CAD5" BorderThickness="1,1,2,2" CornerRadius="5,5,5,5" Name="bdrActivityHeader" Margin="0,-10,0,0" Height="40">
        <Border.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FFF6FDFF" Offset="0"/>
                <GradientStop Color="#FFC5DFE8" Offset="1"/>
            </LinearGradientBrush>
        </Border.Background>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="10.313"/>
                <ColumnDefinition Width="27.687"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="22"/>
                <ColumnDefinition Width="7"/>
            </Grid.ColumnDefinitions>
            <Button Name="btnUpdate" Margin="3,0,3,0" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="4" Click="OnUpdateClick" ToolTip="Upgrade">
                <Button.Content>
                    <Image Height="16" Width="16" Source="/Microsoft.Research.ScientificWorkflow.TridentUtilities;component/Images/ScientificWorkflow/UpdateActivity.png"/>
                </Button.Content>
                <Button.Visibility>
                    <MultiBinding Converter="{StaticResource UpdateVisibilityConverter}">
                        <Binding Path="UpdateAllowedMode" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}"/>
                        <Binding Path="UpdateAvailable"/>
                    </MultiBinding>
                </Button.Visibility>
            </Button>
            <Rectangle Fill="#FFFFFFFF" Stroke="#FF94B3C4" HorizontalAlignment="Right" Margin="0,0,-5,0" x:Name="rectangleRight" VerticalAlignment="Center" Width="10" Height="10" Grid.Column="6"/>
            <Rectangle Fill="#FFFFFFFF" Stroke="#FF94B3C4" HorizontalAlignment="Left" Margin="-5,0,0,0" x:Name="rectangleLeft" VerticalAlignment="Center" Width="10" Height="10" Grid.Column="0"/>
            <Image HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1"  Grid.ColumnSpan="1" Stretch="None" Source="/Microsoft.Research.ScientificWorkflow.TridentUtilities;component/Images/ScientificWorkflow/DataSources.png" />
            <Button  x:Name="btnOptions" Click="OnOptionsButtonClick" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,0,0" Style="{DynamicResource ButtonStyleOptions}" 
                     Grid.Column="5" Width="14" Height="14"  ToolTip="Options"  Content="Button" AutomationProperties.AutomationId="optionButton" 
                     RenderTransformOrigin="0.5,0.5">
                <Button.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                        <SkewTransform AngleX="0" AngleY="0"/>
                        <RotateTransform Angle="90.537"/>
                        <TranslateTransform X="0" Y="0"/>
                    </TransformGroup>
                </Button.RenderTransform>
            </Button>
            <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Name="txtHeader" TextWrapping="Wrap" Grid.Column="2"/>
            <Grid Name="grdExecStatus" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.Column="3" Margin="0,-7,-30,0" >
                <Grid.RenderTransform>
                    <ScaleTransform ScaleX="0.75" ScaleY="0.75"/>
                </Grid.RenderTransform>
                <Grid HorizontalAlignment="Right" Width="26" Height="26" VerticalAlignment="Top" Name="ExecutingIcon"
                      Visibility="{Binding Path=CurrentTridentActivityExecutionStatus, Converter={StaticResource ExecutionStatusImageConverter}, ConverterParameter=ExecutingImageSource}">
                    <Ellipse Stroke="#CCFFFFFF" StrokeThickness="2" x:Name="playbuttonbg2">
                        <Ellipse.Fill>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FF0D7BB3" Offset="0"/>
                                <GradientStop Color="#FF83C6EC" Offset="1"/>
                            </LinearGradientBrush>
                        </Ellipse.Fill>
                    </Ellipse>
                    <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="1.5" Data="M8.6253329,12.875359 C11.792333,4.0427084 19.500333,5.500333 19.500333,5.500333 30.125334,6.7505247 29.625335,16.875153 29.625335,16.875153 21.750333,10.6254 8.6253329,12.875359 8.6253329,12.875359 z" x:Name="playbuttonshade2" Margin="3.793,3.087,3.036,11.292">
                        <Path.Fill>
                            <LinearGradientBrush EndPoint="0.433,0.701" StartPoint="0.5,0">
                                <GradientStop Color="#B2FFFFFF" Offset="0"/>
                                <GradientStop Color="#00FFFFFF" Offset="1"/>
                            </LinearGradientBrush>
                        </Path.Fill>
                    </Path>
                    <Rectangle Stroke="{x:Null}" StrokeThickness="1.5" HorizontalAlignment="Left" Margin="7.176,8.309,0,7.691" Width="2.625" Fill="#66FFFFFF" x:Name="rectangle"/>
                    <Rectangle Fill="#66FFFFFF" Stroke="{x:Null}" StrokeThickness="1.5" Margin="11.741,8.309,11.634,7.691" x:Name="rectangle1"/>
                    <Rectangle Fill="#66FFFFFF" Stroke="{x:Null}" StrokeThickness="1.5" Margin="0,8.309,7.069,7.691" Width="2.625" HorizontalAlignment="Right" x:Name="rectangle2"/>
                </Grid>
                <Grid HorizontalAlignment="Right" Width="26" Height="26" VerticalAlignment="Top" Name="ClosedIcon"
                      Visibility="{Binding Path=CurrentTridentActivityExecutionStatus, Converter={StaticResource ExecutionStatusImageConverter}, ConverterParameter=CompletedImageSource}">
                    <Ellipse Stroke="#CCFFFFFF" StrokeThickness="2" x:Name="playbuttonbg1">
                        <Ellipse.Fill>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FF18B30D" Offset="0"/>
                                <GradientStop Color="#FF59E64F" Offset="1"/>
                            </LinearGradientBrush>
                        </Ellipse.Fill>
                    </Ellipse>
                    <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="1.5" Data="M8.6253329,12.875359 C11.792333,4.0427084 19.500333,5.500333 19.500333,5.500333 30.125334,6.7505247 29.625335,16.875153 29.625335,16.875153 21.750333,10.6254 8.6253329,12.875359 8.6253329,12.875359 z" x:Name="playbuttonshade1" Margin="3.793,3.087,3.036,11.292">
                        <Path.Fill>
                            <LinearGradientBrush EndPoint="0.433,0.701" StartPoint="0.5,0">
                                <GradientStop Color="#B2FFFFFF" Offset="0"/>
                                <GradientStop Color="#00FFFFFF" Offset="1"/>
                            </LinearGradientBrush>
                        </Path.Fill>
                    </Path>
                    <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="1.5" Margin="5.833,8.333,6.5,6.956" Data="M5.8333333,14 L11.018059,19.04467 19.49939,9.8329158 18.499459,8.3331661 10.632913,14.679488 6.5002874,11.833565 z" Fill="#FFFFFFFF"/>
                </Grid>
                <Grid HorizontalAlignment="Right" Width="26" Height="26" VerticalAlignment="Top" Name="FaultingIcon"
                      Visibility="{Binding Path=CurrentTridentActivityExecutionStatus, Converter={StaticResource ExecutionStatusImageConverter}, ConverterParameter=FaultingImageSource}">
                    <Ellipse Stroke="#CCFFFFFF" StrokeThickness="2" x:Name="playbuttonbg3">
                        <Ellipse.Fill>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FFC42A2A" Offset="0"/>
                                <GradientStop Color="#FFFF6565" Offset="1"/>
                            </LinearGradientBrush>
                        </Ellipse.Fill>
                    </Ellipse>
                    <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="1.5" Data="M8.6253329,12.875359 C11.792333,4.0427084 19.500333,5.500333 19.500333,5.500333 30.125334,6.7505247 29.625335,16.875153 29.625335,16.875153 21.750333,10.6254 8.6253329,12.875359 8.6253329,12.875359 z" x:Name="playbuttonshade3" Margin="3.793,3.087,3.036,11.292">
                        <Path.Fill>
                            <LinearGradientBrush EndPoint="0.433,0.701" StartPoint="0.5,0">
                                <GradientStop Color="#B2FFFFFF" Offset="0"/>
                                <GradientStop Color="#00FFFFFF" Offset="1"/>
                            </LinearGradientBrush>
                        </Path.Fill>
                    </Path>
                    <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="2" Margin="10.784,6.163,10.902,11.149" Data="M11.701627,8.0009042 L12.372672,15.173164 14.011686,15.241177 14.56827,7.8270056 z" Fill="#FFFFFFFF"/>
                    <Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="2" Margin="11.103,0,11.147,4.834" VerticalAlignment="Bottom" Height="3.928" Data="M11.395564,17.238573 L14.853121,17.333691 14.771832,21.163108 11.102494,20.999791 z"/>
                </Grid>
            </Grid>
        </Grid>
    </Border>
</UserControl>